NavboxBuilder
NavboxBuider is a module that makes creating navboxes a breeze. Features * Unlimited amount of rows and sections. * Collapsible navbox and sections. * Possibility to customize/localize parameter names. * Parameter documentation stored on Dev Wiki and tailored to custom parameter names Installation In order to use it you need to have Scribunto extension enabled on your wiki. If it isn't available for your community, just ask for it via . Module First thing is the module itself. You don't need to copy the code. Just create a module titled Module:NavboxBuilder (or any other – just remember to adjust #invoke calls) and put this in the code return require('Module:NavboxBuilder') You can also customize parameters and change some additional settings at this point. See their respective sections for more info. CSS There are two things to do here. First is importing the stylesheet that gives structure to the navbox. To do that just add this at the top of your . @import "http://dev.wikia.com/load.php?mode=articles&articles=NavboxBuilder/code.css&only=styles"; Second is changing how it looks. More info on that can be found in the Design section below. Template The module is designed to be used as a regular template. To do that just create a template (ex: Template:Navbox) with following content: Now the template you created will accept parameters documented below. These parameters can also be passed directly to the #invoke and will act as defaults. Their values will be overridden by same ones passed to the template. Good for default styling etc. You can also insert parameter documentation on your wiki with It'll display in your wiki's language (if a translation exists) and change to reflect customized parameters. See the talk page for more info if you want to help translating. Parameters Customizing parameters When importing the module. Copy this and fill in yours return require('Module:NavboxBuilder').changeParameters{ -- Settings tpllinks = 'Links', state = 'State', -- Fields title = 'Title', above = 'Above', below = 'Below', limage = 'Left image', rimage = 'Right image', -- Sections header_n = 'Header #', limage_n = 'Left image #', rimage_n = 'Right image #', state_n = 'State #', -- Groups group_n = 'Group #', group_n_m = 'Group #.#', list_n = 'List #', list_n_m = 'List #.#', -- CSS navbox_class = 'Navbox class', navbox_style = 'Navbox style', title_class = 'Title class', title_style = 'Title style', base_class = 'Base class', base_style = 'Base style', above_class = 'Above class', above_style = 'Above style', below_class = 'Below class', below_style = 'Below style', image_class = 'Image class', image_style = 'Image style', limage_class = 'Left image class', limage_style = 'Left image style', rimage_class = 'Right image class', rimage_style = 'Right image style', header_class = 'Header class', header_style = 'Header style', header_n_class = 'Header # class', header_n_style = 'Header # style', limage_n_class = 'Left image # class', limage_n_style = 'Left image # style', rimage_n_class = 'Right image # class', rimage_n_style = 'Right image # style', group_class = 'Group class', group_style = 'Group style', group_n_class = 'Group # class', group_n_style = 'Group # style', group_n_m_class = 'Group #.# class', group_n_m_style = 'Group #.# style', list_class = 'List class', list_style = 'List style', list_n_class = 'List # class', list_n_style = 'List # style', list_n_m_class = 'List #.# class', list_n_m_style = 'List #.# style', -- Values value_expanded = 'expanded', value_collapsed = 'collapsed', } Examples Here are few example to show what the module is capable of and how to achieve that. ''Note: examples below use for styling.'' Title and few rows Collapsible navbox Template links Title and groups aren't required Above and below Sections Collapsible sections Images Subgroups Styling Bit of everything Additional settings These settings require you to alter how the module is imported to: local NBB = require('Module:NavboxBuilder') Put your settings here return NBB Horizontal lists If you use horizontal lists on your wiki, just set this to true. This will add the hlist class to all lists without worrying for them being overwritten when put in the parameter. NBB.hlist = true ''Note: If you use a different class name, you can specify it as a string.'' N's and M's If you want to change how they appear in the documentation, just change it like so: NBB.n = "your N replacement" NBB.m = "your M replacement" ''Note: Templates, parser functions etc won't be parsed thou. Only basic wikisyntax, like italics and html tags.'' Design If you want to customize the look of your navbox, you have few options. One of it is by using parameters, preferably by passing them to #invoke as defaults. There are few classes that adhere to wiki's theme that are perfect for this, like color1, accent. You can achieve the look like this: With as little as this in your Navbox template: The other way is styling it in your . You can find a guide to classes below. * Main navbox element ** .navbox ** .mw-collapsible – when collapsing is enabled ** .mw-collapsed – when it's collapsed * Title bar ** .navbox-title ** .mw-collapsible-toggle – when the navbox is collapsible ** .mw-collapsible-toggle-expanded – when the navbox is expanded ** .mw-collapsible-toggle-collapsed – when the navbox is collapsed * Above and below ** .navbox-above and .navbox-below * Left and right images (both main and sections) ** .navbox-image * Section header ** .navbox-header ** .mw-collapsible-toggle – when the section is collapsible ** .mw-collapsible-toggle-expanded – when the section is expanded ** .mw-collapsible-toggle-collapsed – when the section is collapsed * Rows ** .navbox-odd – for odd numbered rows ** .navbox-even – for even numbered rows * Groups ** .navbox-group * Subgroups ** .navbox-subgroup * Lists ** .navbox-list ** .navbox-nogroup – when there's no group for this row * Shared classes ** .navbox-padding – a way to customize padding of cells. Applies to all lists, groups, subgroups and above/below fields. But not to headers and the title. ** .navbox-base – a way to highlight headings. Applies to all groups, subgroups, header and above/below fields. Spacing If you want to change the size of spaces between cells, here's what you have to change: .navbox-table { border-spacing: 3px; } .navbox-table-wrapper { margin: 0 -3px -3px; } .navbox > .navbox-table-wrapper:first-child, .navbox-section > .navbox-table-wrapper:first-child { margin-top: -3px; } .navbox-section { margin-top: 3px; } Category:Modules